package com.ssm.juc.synchronized1;

public class NoSivibilityVariable {
    private static boolean isOver = false;

    public static void main(String[] args) {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                synchronized (NoSivibilityVariable.class) {
                    System.out.println("thread ----- isOver=false");
                    while (!isOver);
                    System.out.println("thread ----- true");
                }
            }
        });
        thread.start();


        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("thread ----- isOver=true");
        synchronized (NoSivibilityVariable.class) {
            isOver = true;
        }
        System.out.println("main ----- true");
    }
}